package com.hx.jvm.jvm.oom;

/**
 * Java虚拟机栈溢出
 * <p>
 * JVM参数：-Xss128k   设置每个线程的堆栈大小
 *
 * @author jxrjc
 */
public class JavaVMStackSOF {

    private int stackLen = 1;

    public static void main(String[] args) {
        JavaVMStackSOF sof = new JavaVMStackSOF();
        try {
            sof.stackLeak();
        } catch (Exception e) {
            System.out.println("栈的深度为：" + sof.stackLen);
            throw e;
        }


    }

    private void stackLeak() {
        stackLen++;
        stackLeak();
    }

}
